//
//  ForegroundColorAttributeConfig.m
//  MyFunctionDemo
//
//  Created by Ting Han on 2017/9/1.
//  Copyright © 2017年 Ting Han. All rights reserved.
//

#import "ForegroundColorAttributeConfig.h"

@implementation ForegroundColorAttributeConfig

- (NSString *)attributeName{
    return NSForegroundColorAttributeName;
}
- (id)attributeValue{
    if (self.color) {
        return self.color;
    }else{
        return [UIColor blackColor];
    }
}
+ (instancetype)configWithColor:(UIColor *)color{
    ForegroundColorAttributeConfig *config = [[[self class]alloc]init];
    config.color = color;
    return config;
}
+ (instancetype)configWithColor:(UIColor *)color range:(NSRange)range{
    ForegroundColorAttributeConfig *config = [[[self class]alloc]init];
    config.color = color;
    config.effectiveStringRange = range;
    return config;
}
@end
